<?php include TMPL_PATH.'public/header.phtml';?>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
    	<div style="float:left;margin-right:50px;">
        <a href='javascript:;' class="on"><em>留言列表</em></a>
      </div>
    	<div style="color:#000;">
    		<form name="searchform" action="__SELF__"  method="post">
    		<input type="hidden" value="1" name="search">
    		类型：<select name="message_type">
    			<option>-全部-</option>
    			<?php 
    				$messageType = CommentModel::$messageType;
    				foreach ($messageType as $tk => $tv):
    			?>
    			<option value="<?php echo $tk; ?>"><?php echo $tv;?></option>
    			<?php endforeach;?>
    		</select>&nbsp;&nbsp;&nbsp;
				留言人 <input type="text" class="input-text" name="username">&nbsp;&nbsp;&nbsp;
				留言标题 <input type="text" class="input-text" name="title">
				<input type="submit" value="搜索" class="button" name="search">
    		</form>
    	</div>
    </div>
</div>
<div class="bk"></div>
<div class="pad_10">
<div class="table-list">
<form action="<?php echo U('comment/guestbook_delete');?>" method="post">
    <table width="100%" cellspacing="0" >
        <thead>
            <tr>
            <th width="38">选择</th>
            <th align='center' width="80">留言人</th>
            <th align='left' width="200">标题/产品</th>
            <th align='left'>内容</th>
			<th align='center' width="80">类型</th>
            <th align='center' width="150">时间</th>
            <th align='center' width="80">状态</th>
						<th align='center' width="80">操作</th>
            </tr>
        </thead>
    <tbody>
    <?php 
   	if(isset($guestbookList) && $guestbookList):
   		foreach ($guestbookList as $v):
   ?>
			<tr>
					<td align='center'><input name="ids[]" type="checkbox" value="<?php echo $v['id']?>" /></td>
					<td align='center'><?php echo $v['username']?></td>
					<td><?php echo $v['title']?></td>
					<td><?php echo $v['content'];?></td>
					<td align="center"><?php echo CommentModel::$messageType[$v['message_type']];?></td>
					<td align='center'><?php echo date('Y-m-d H:i:s', $v['start_time']);?></td>
					<td align='center' id="status-<?php echo $v['id']?>">
					<?php if($v['disabled']):?>
					<a href="javascript:setting_status(<?php echo $v['id']?>,0);"><font color="red">√</font></a>
					<?php else:?>
					<a href="javascript:setting_status(<?php echo $v['id']?>,1);"><font color="blue">×</font></a>
					<?php endif;?>
					</td>
				<td align='center'><?php if($v['reply_time']){echo'<font class="red">已回复</font>';}?><a href="<?php echo U('comment/guestbook_edit', 'gbid='.$v['id'])?>">回复</a></td>
				</tr>
	<?php 
		endforeach;
		endif;
	?>
   </tbody>
    </table>
   <div class="btn"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');">全选/取消 <input type="submit" class="button" name="dosubmit" value="删除"/></div>
</form>
<div id="pages"><?php echo $pageShow;?></div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
<!--
function setting_status(id,disabled){
	$.get('<?php echo U('comment/change_guestbook_status_ajax');?>&gbid='+id+'&disabled='+disabled,function(){
			if(disabled==0){
				$('#status-'+id).html('<a href="javascript:setting_status('+id+',1);"><font color="blue">×</font></a>');
			}else{
				$('#status-'+id).html('<a href="javascript:setting_status('+id+',0);"><font color="red">√</font></a>');
			}
		});
}
//-->
</script>